<?php session_start(); 

//require_once("process_login.php");
//include("db.php");

if(isset($_SESSION['user_id'])) {
	
	//checks if session is still set... and redirects to dashboard
	//instead of staying in login page
	header('Location: dashboard.php');
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
	<title>Persofolio Beta Login</title>
	<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
	<script type="text/javascript" src="http://localhost/~ghost/project_perso/js/jquery.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			
			//pass.hide();	
			//alert(username.post(login.php, {'user'}));
			/*username.focus(function() {
				console.log(this);
				if(this == <?php echo $_POST['user'];?>) {
					$(this).css({"border" : "1px solid black"});
				}
				
				//$(this).document.write("test");
			});*/
			
			var username = $("#username");
				pass = $("#password"); 
			 	login = $("input#login_s");
				base = "http://localhost/~ghost/project_perso/";
				
			login.submit(function() {
				
				/*if(username.val() == "<?php echo $_POST['user']; ?>") {
					alert("<?php $_POST['user']; ?>");
				}*/
				
				//alert(username.focus());
				if(username.val() == false) {
					username.css({"border" : "1px solid red"});
					//return false;
				}
				
				if(pass.val() == false) {
					pass.css({"border" : "1px solid red"});
				}
				
				//alert("submitted");
				
				return false;
			});
		});
	</script>
</head>

<body>
	<div id="login_head">
		<center><img src="images/perso_login.png" width="310" height="59" /></center>
		<br />
		<?php
			if(isset($_GET['logout']) && $_GET['logout'] == 1) {
				echo "<center>You are now logged out...</center>";
			} 
			
		?>
	</div>
	
	<div id="login_container">
		<div id="login">
			
			<form method="post" action="process_login.php">
				<label>username</label>
				<br />
				<input id="username" name="user" type="text" size="40" maxlength="20" />
				<br />
				<br />
			
				<label>password</label>
				<br />
				<input id="password" name="pass" type="password" size="40" maxlength="20" />
				<br />
			
				<input id="login_s" type="submit" value="Login!" />
			</form>
			
		</div> <!-- end login -->
	</div> <!-- end login container -->
	
	<div id="colophon">
		<div id="content">
			<p>Persofolio Group, LLC &copy;2011</p>
		</div>
	</div>
	
	<?php
		
	/*	echo "<pre>";
			print_r($testinfo);
		echo "</pre>"; */
		
	?>
	
</body>

</html>